# -*- coding:utf-8 -*-
"""
@Time : 2020-12-15 11:54
@Author: langengel
@Des: 服务商验证模型
"""


from pydantic import BaseModel, Field
from typing import Optional, List


class ServiceLogin(BaseModel):
    """
    服务商登录
    """
    web_code: str = Field(max_length=32, min_length=32, title="访问码")
    s_id: str = Field(title="服务商id")
    u_id: str = Field(title="用户id")


class GetService(BaseModel):
    """
    获取组织信息
    """
    password: str = Field(max_length=20, min_length=8, title="登录密码")
    user_phone: str = Field(min_length=11, max_length=11, title="手机号")


class ServiceCreate(BaseModel):
    """
    创建服务商
    """
    web_code: str = Field(max_length=32, min_length=32, title="访问码")
    service_name: str = Field(min_length=3, max_length=30, title="组织名称")


class PhoneCode(BaseModel):
    """
    发送短信
    """
    phone: str = Field(max_length=11, min_length=11, title="手机号")
    web_code: str = Field(max_length=32, min_length=32, title="访问码")


class CreateRole(BaseModel):
    role_name: str = Field(min_length=2, max_length=10)
    role_status: Optional[bool] = True
    role_desc: Optional[str]


class LocationModel(BaseModel):
    region_Id = int
    pid = int
    region_code = str
    name = str
    level = int


class WechatUser(BaseModel):
    city = str
    country = str
    headimgurl = str
    nickname = str
    openid = str
    province = str
    sex = int


class UpdateRole(BaseModel):
    role_id: int
    role_name: str
    role_desc: Optional[str]
    role_status: bool


class ChangeStatus(BaseModel):
    role_id: int
    role_status: bool


class SetScopes(BaseModel):
    role_id: int
    scopes: List[int]
